Skip to content

Fix path-only Python project manager defaults - #1667

Open
Atomie CHEN (atomiechen) wants to merge 2 commits into
microsoft:mainfrom
atomiechen:fix-optional-python-project-managers
Open

Fix path-only Python project manager defaults#1667
Atomie CHEN (atomiechen) wants to merge 2 commits into
microsoft:mainfrom
atomiechen:fix-optional-python-project-managers

Conversation

@atomiechen

@atomiechen Atomie CHEN (atomiechen) commented Jul 27, 2026

Copy link
Copy Markdown

Summary

Fixes #1666.

Path-only entries are valid according to the python-envs.pythonProjects setting schema:

{
    "python-envs.pythonProjects": [
        {
            "path": "backend"
        }
    ]
}

However, the manager-setting helpers called .length on the omitted envManager and packageManager properties. This caused repeated TypeError failures during post-initialization telemetry and environment lookup.

Fix

  • Treat omitted or empty project-level manager values as requests to use the corresponding default setting.
  • Mark PythonProjectSettings.envManager and .packageManager optional so the internal type matches the contributed JSON schema.
  • Add a unit test covering a path-only nested project entry and both default-manager fallbacks.

Validation

  • Reproduced with VS Code 1.130.0 and the latest stable extensions in an empty --user-data-dir / --extensions-dir profile.
  • Installed the patched 1.37.0 VSIX in a second empty profile and verified that the same workspace starts without TypeError or post-initialization failure.
  • npm run compile-tests
  • npm run lint
  • npm run unittest — 1,429 passing, 6 pending

AI disclosure: Prepared with assistance from OpenAI Codex.

@atomiechen
Atomie CHEN (atomiechen) force-pushed the fix-optional-python-project-managers branch from d7702f7 to 8a98b2f Compare July 27, 2026 10:55
@atomiechen

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

@heejaechang

Heejae Chang (heejaechang) commented Aug 19, 2026

Copy link
Copy Markdown

🔒 Automated review in progress — Heejae Chang (@heejaechang) is auto-reviewing this PR.

test('uses default managers when a pythonProjects entry only specifies path', () => {
sinon.stub(workspaceApis, 'getConfiguration').returns(createPathOnlyProjectConfig());
sinon.stub(workspaceApis, 'getWorkspaceFolder').returns(workspaceFolder);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Info · Optional note

The fallback test covers omitted manager values but not explicitly empty strings, despite the PR claiming both cases. Consider adding empty-string assertions to preserve that behavior explicitly.

[verified]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved via Review Center.

@heejaechang Heejae Chang (heejaechang) added the review-auto:approved Automated review: no blocking findings (approval posted). label Aug 19, 2026
@heejaechang

Copy link
Copy Markdown

Verification: The relevant tests could not be fully run in the isolated environment; this review is not fully verified.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

review-auto:approved Automated review: no blocking findings (approval posted).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Path-only pythonProjects entries crash manager initialization

3 participants